<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>$Title$</title>
</head>
<body>
<form>
    <label>
        <input id="id" type="text" name="username">
    </label>
    <input type="button" onclick="testJson()" value="提交">
</form>
</body>
</html>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.6.0.min.js"></script>
<script>
    function testJson() {
        let id = $("#id").val();
        $.ajax({
            url: "${pageContext.request.contextPath}/rest/" + id,
            type: "post",
            contentType: "application/json;charset=UTF-8",
            dataType: "json",
            success(response) {
                console.log(response);
                alert(response.username + response.pwd);
            }
        })
    }
</script>
